package models

import "time"

var (
	DeviceBindStatus map[int]string
	DeviceType       map[int]string
)

// 设备
type Device struct {
	Id             int64     `orm:"description(自增主键)"`
	Sn             string    `orm:"description(设备唯一标识)"`
	Place          string    `orm:"description(所在位置，如学校南门)"`
	School         *School   `orm:"rel(fk);null;default(0);description(所属学校)"`
	Username       string    `orm:"description(用户名)"`
	Password       string    `orm:"description(密码)"`
	BindStatus     int       `orm:"description(绑定状态，0未绑定 1已绑定)"`
	BindStatusShow string    `orm:"-"`
	Type           int       `orm:"description(设备类型，1门禁 2校车)"`
	TypeShow       string    `orm:"-"`
	DeviceCode     string    `orm:"description(物理设备码)"`
	Mac            string    `orm:"description(物理设备mac地址)"`
	Created        time.Time `orm:"auto_now_add;type(datetime);description(创建时间)"`
	CreatedShow    string    `orm:"-"`
	Updated        time.Time `orm:"auto_now;type(datetime);description(最后一次更新时间)"`
	UpdatedShow    string    `orm:"-"`
}

func init() {

	DeviceBindStatus = map[int]string{
		0: "未绑定",
		1: "已绑定",
	}

	DeviceType = map[int]string{
		0: "未知",
		1: "门禁设备",
		2: "校车设备",
	}

}
